home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
09
/
3
/
DISK0932.ZIP
/
SOURCE.EXE
/
arc
/
GETREAL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-09-08
|
1KB
|
54 lines
PROGRAM getreal; {Or, how do you bullet-proof numerical entries?}
{One choice is don't, then get I/O crashes.....}
{Contributed by: Count Zero Interrupt & }
{ 6/87 General Max von Birdface (Ret)}
VAR
number : REAL;
code : INTEGER;
PROCEDURE getreal1 (VAR number:REAL; VAR code:INTEGER);
{ Looks at entry and assigns codes for appropriate & other types }
VAR
entry : STRING[30];
BEGIN
Read(entry);
Val(entry,number,code);
CASE Length(entry) OF
0 : code := -2;
1 :
IF code > 0 THEN
BEGIN
code := -1;
END
END;
END;
{ Mainline for Procedure }
BEGIN
ClrScr;
GotoXY(1,23);
Write('Enter a number: ');
REPEAT
getreal1(number,code);
IF (code <> 0) THEN
BEGIN
Sound(100);
Delay(500);
NoSound;
GotoXY(1,23);
ClrEol;
GotoXY(20,23);
Write('Please!! Just Enter NUMBERS!! : ');
END
UNTIL (code = 0);
GotoXY(1,15);
Write('The number is: ',number:4:1);
END.